<template>
  <el-container>
    <basic-crud :option="option" apiGetListUrl="/mes/nonconformingController/grid">
    </basic-crud>
  </el-container>
</template>

<script setup>
import {formatDate} from "../../../utils/formatTime"
const option = ref({
  highlightCurrentRow: true,
  addBtn:false,
  editBtn:false,
  viewBtn:true,
  delBtn:false,
  size: 'small',
  menuWidth:80,
  searchLabelWidth: 120,
  labelWidth: 140,
  column:[
    {
      label: "状态",
      prop: "status",
      search: true,
      sortable: true,
      searchType: "select",
      virtualize: true,
      statusShow: true,
      statusTag:true,
      statusTypeMap:{
        Released:'success',
        Auditing:'warning'
      }
    },
    {
      label: "编号",
      prop: "code",
      overHidden: true,
      minWidth: 200,
      disabled: true,
      search: true
    },
    {
      label: "型号",
      prop: "modelName",
      overHidden: true,
      search: true,
      minWidth: 180,
      disabled: true
    },
    {
      label: "产品名称",
      prop: "productName",
      overHidden: true,
      disabled: true,
      search: true,
      minWidth: 180,
    },
    {
      label: "产品编号",
      prop: "productCode",
      overHidden: true,
      minWidth: 150,
      search: true,
      disabled: true
    },
    {
      label: "生产部门",
      prop: "productDeptName",
      overHidden: true,
      minWidth: 150
    },
    {
      label: "不合格生产处特性",
      prop: "peculiarity",
      overHidden: true,
      width: 120,
      type: "radio",
      virtualize: true,
      dicData: [
        {
          label: "关键特性",
          value: "0",
        },
        {
          label: "重要特性",
          value: "1",
        },
        {
          label: "一般特性",
          value: "2",
        },
      ],
      formatter: (row) => {
        let text = "";
        switch (row.peculiarity) {
          case "0":
            text = "关键特性";
            break;
          case "1":
            text = "重要特性";
            break;
          case "2":
            text = "一般特性";
            break;
        }
        return text;
      },
      span: 24,
    },
    {
      label: "交检数量",
      prop: "inspectionQuantity",
      width: 80,
      type: "number",
    },
    {
      label: "不合格数量",
      prop: "unqualifiedQuantity",
      width: 80,
      type: "number",
    },
    {
      label: "发现时机",
      prop: "findMoment",
      width: 110,
      type: "radio",
      virtualize: true,
      dicData: [
        {
          label: "入所复检",
          value: "0",
        },
        {
          label: "工序交检",
          value: "1",
        },
        {
          label: "出所交检",
          value: "2",
        },
        {
          label: "用户代表检查",
          value: "3",
        },
        {
          label: "生产自查",
          value: "4",
        },
        {
          label: "其他",
          value: "5",
        },
      ],
      formatter: (row) => {
        let text = "";
        switch (row.findMoment) {
          case "0":
            text = "入所复检";
            break;
          case "1":
            text = "工序交检";
            break;
          case "2":
            text = "出所交检";
            break;
          case "3":
            text = "用户代表检查";
            break;
          case "4":
            text = "生产自查";
            break;
          case "5":
            text = "其他";
            break;
        }
        return text;
      },
      span: 24,
    },
    {
      label: "图纸、技术条件要求",
      prop: "technicalRequirements",
      width: 200,
      overHidden: true,
      type: "textarea",
      span: 24,
    },
    {
      label: "检验结论（超差描述）",
      prop: "nonconforming",
      overHidden: true,
      width: 150,
      type: "textarea",
      span: 24,
    },
    {
      label: "提出人",
      prop: "proposerName",
      width: 100,
    },
    {
      label: "提出时间",
      prop: "proposeTime",
      width: 120,
      formatter: (row) => {
        return row.proposeTime?.substring(0, 10) || "";
      },
    },
    {
      label: "归零时间",
      prop: "zeroingTime",
      width: 120,
      formatter: (row) => {
        return row.zeroingTime?.substring(0, 10) || "";
      },
    },  {
      label: "附件",
      prop: "fileNames",
      minWidth: 300,
      editDisplay:false,
      addDisplay:false,
      formslot:true,
      viewDisplay:false,
      span:24
    },
  ]
})
</script>

<style lang="scss" scoped>

</style>
